<template>
  <el-container>
    <el-header height="80px">
        <el-row class="header">
            <el-col :span="4"><h1>XXX管理系统:</h1></el-col>
            <el-col :span="4" :offset="15"><h3>手机号：</h3></el-col>
            <el-col :span="1" ><el-button type="primary" icon="el-icon-upload2" circle  @click="out()">注销</el-button></el-col>
        </el-row>
        
    </el-header>
    <el-container>
        <el-aside width="200px">
            <el-menu
      :default-active="$router.history.current.path"
      class="el-menu-vertical-demo"

      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      :router="true">
      <template>

      </template>
      <!-- <el-menu-item v-for="ele in functions" :key="ele.functionId" :index="ele.url">
        <i class="el-icon-menu"></i>
        <span slot="title">{{ele.functionName}}</span>
      </el-menu-item> -->
      <el-menu-item index="/manage/user">
        <i class="el-icon-menu"></i>
        <span slot="title">用户管理</span>
      </el-menu-item>
      <el-menu-item index="/manage/student">
        <i class="el-icon-menu"></i>
        <span slot="title">学生管理</span>
      </el-menu-item>
      <el-menu-item index="/manage/student">
        <i class="el-icon-menu"></i>
        <span slot="title">班级管理</span>
      </el-menu-item>
      <el-menu-item index="/manage/student">
        <i class="el-icon-menu"></i>
        <span slot="title">课程管理</span>
      </el-menu-item>
      
    </el-menu>
        </el-aside>
        <el-main>
            <router-view></router-view>
        </el-main>
    </el-container>
</el-container>
</template>

<script>

export default {
    data(){
      return {
             user:{}
        }
    },
    computed:{
    },
    methods:{
       async getUser() {
      alert("判断登录")
      var cutObj = await this.ajax.getSubmit("/project/users/getUser");
      alert(JSON.stringify(cutObj));
     
              if(cutObj.length == 0){
             
             alert("请先登录");
            this.$router.push("/login");
          }
          else{
             this.user=cutObj;
          }
      
      },
      async out(){
        this.ajax.getSubmit("/project/users/setUser");
         this.$router.push("/manage");
      }

    },
     created(){
         this.getUser()
    },updated(){
      this.getUser()
    }
   
}
</script>

<style>
    .el-header{
        background: #2b303b;
        color: white;
        
    }
    .header{
        display: flex;
        align-items: center;
    }
    .el-container,.el-aside,.el-menu{
        height:100%;
    }
</style>